package com.yzd.learnjava.interfaces.interfaceprocessor;

import com.yzd.learnjava.interfaces.filters.BandPass;
import com.yzd.learnjava.interfaces.filters.Filter;
import com.yzd.learnjava.interfaces.filters.HighPass;
import com.yzd.learnjava.interfaces.filters.LowPass;
import com.yzd.learnjava.interfaces.filters.Waveform;

class FilterAdater implements Processor{
	Filter filter;
	public FilterAdater(Filter filter) {
		this.filter = filter;
	}
	
	public String name() {
		return filter.name();
	}
	
	public Waveform process(Object obj) {
		return filter.process((Waveform)obj);
	}
}

public class FilterProcessor{
	public static void main(String[] args) {
		Waveform w = new Waveform();
		Apply.process(new FilterAdater(new LowPass(1.0)), w);
		Apply.process(new FilterAdater(new HighPass(2.0)), w);
		Apply.process(new FilterAdater(new BandPass(3.0, 4.0)), w);
	}
}
